package cn.csdj.sism.service.impl;

import cn.csdj.sism.dao.AccommodationMapper;
import cn.csdj.sism.pojo.Accommodation;
import cn.csdj.sism.service.AccommodationService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AccommodationServiceImpl implements AccommodationService {
    @Autowired
    private AccommodationMapper accommodationMapper;
    @Override
    public int insert(Accommodation accommodation) {
        return accommodationMapper.insert(accommodation);
    }

    @Override
    public int deleteById(Integer id) {
        return accommodationMapper.deleteById(id);
    }

    @Override
    public int update(Accommodation accommodation) {
        return accommodationMapper.updateById(accommodation);
    }

    @Override
    public Accommodation selectById(Integer id) {
        return accommodationMapper.selectById(id);
    }

    @Override
    public List<Accommodation> selectAll() {
        return accommodationMapper.selectList(null);
    }
    @Override
    public IPage<Accommodation> selectPages(Integer current,Integer pageSize) {
        IPage<Accommodation> page=new Page(current,pageSize);
        accommodationMapper.selectPage(page,null);
        return page;
    }
}
